package Day10Zuoye;

public class Teacher {
    private int age;
    private String school;
    private String name;

    public void setAge(int age) throws Exception {
        if (age>22)
            this.age = age;
        else {
            throw new Exception("年龄必须小于22岁！");
        }
    }
    public void attendclass(){
        System.out.println("上课了");
    }
    public void introducemyself(String name,String school){
        System.out.println("自我介绍:");
        System.out.println("我的名字是:"+name+"来自"+school+","+age+"岁了");
    }

    public Teacher() {
    }

    public Teacher(int age, String school, String name) {
        this.age = age;
        this.school = school;
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public String getSchool() {
        return school;
    }

    public void setSchool(String school) {
        this.school = school;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
